<template>
  <div>
    <table-ext :columns="columns" :searchForm="searchForm" :config="config" ref="tableExt">
       <template slot="table-action">
          <!-- <el-button type="info">导入</el-button> -->
       </template>
    </table-ext>
  </div>
</template>
<script>
  import TableExt from '@/components/common/table-ext/table-ext.vue';
  import TableIcon from '@/components/common/table-ext/table-icon';
   export default {
    // 引入自定义表格组件
    components:{
      'table-ext': TableExt
    },
    data() {
      return {
        config:{ // 页面共通配置
          title: 'RFI', //页面标题
          isPage: true, //是否分页
          isNo: true, //是否显示序号
          selection: false, //是否显示复选框
          crudMapping:{ // CRUD方法
            query:{
              url: this.lib.config.host.vendorMgt + '/vendormgt/vsp/rfiitem/findByVendorId/' + this.$route.query.id,
              method: 'securityPost'
            }
          }
        },
        // 表格列定义
        columns:[
          { 
          label: '操作', // 表格header
          width:'130',
          render:(createElement, params)=>{ // 动态渲染，click事件示例
            let _this = this;
             return createElement('div', {}, 
              [createElement('el-button', {
                  props: {
                    type: 'text',
                  },
                  on: {
                    click() {
                      _this.toView(params.row.id,params.row.rfiId);
                    }
                  }
                }, '查看')
              ]);
          }
        },{
          label: 'RFI编码',
          key: 'rfi.rfiCode',
          width:'120'
        },{
          label: '采购组织',
          key: 'rfi.purOrgName',
          width:'110'
        },{
          label: '采购组',
          key: 'rfi.purGroupName',
          width:'110'
        },{
          label: '标题',
          key: 'rfi.title',
          width:'200'
        },{
          label: 'RFI类型',
          key: 'rfi.infoType',
          width:'110',
          render:(createElement, params)=>{
            if (params.row.rfi.infoType == 'rfi2') {
               return createElement('div', '产品认证');
            }else if(params.row.rfi.infoType == 'rfi3'){
              return createElement('div', '调查问卷');
            }
          }
        },{
          label: '反馈状态',
          key: 'feedbackStatus',
          width:'110',
          render:(createElement, params)=>{ //动态渲染, 字典表示例
            return createElement(TableIcon,{props:{
                flag: params.row.feedbackStatus,
                titles: [{status:0,title:'未反馈'},{status:1,title:'已反馈'},{status:2,title:'部分反馈'}]
            }});
          }
        },{
          label: '反馈人',
          key: 'feedbackUserName',
          width:'110'
        },{
          label: '反馈日期',
          key: 'feedbackTime',
          width:'110'
        },{
          label: '审核状态',
          key: 'checkStatus',
          width:'110',
          align: 'center',
          render:(createElement, params)=>{ //动态渲染, 字典表示例
            return createElement(TableIcon,{props:{
                flag: params.row.checkStatus,
                titles: [{status:0,title:'未审核'},{status:1,title:'已审核'},{status:3,title:'待审核'},{status:-1,title:'驳回'}]
            }});
          }
        },{
          label: '审核意见',
          key: 'checkOpinoin',
          width:'200'
        },{
          label: '审核人',
          key: 'checkUserName',
          width:'110'
        },{
          label: '审核时间',
          key: 'checkTime',
          width:'110'
        }
        ]
      };
    },
    mounted(){
    },
    methods: {
      toView(id,rfiId) {
         this.$router.push('/Index/Supplier/common/RfiItemView?id='+ id + '&'+'rfiId' + '=' + rfiId);
      }
    }
  }
</script>